package com.demo.demo.rabbitmq.topics;

import com.demo.demo.utils.RabbitMQUtils;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Provider {
    public static void main(String[] args) throws IOException, TimeoutException {
        Connection connection = RabbitMQUtils.getConnection();
        Channel channel = connection.createChannel();
        channel.exchangeDeclare("topics","topic");
        String routeKey = "users.save.log";
        channel.basicPublish("topics",routeKey,null,("topics动态路由"+routeKey).getBytes());
        RabbitMQUtils.closeConnectionAndChanel(channel,connection);
    }
}
